home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / util / time / DRemind.lha / DRemind / MReminder / MRemind-GUI / Deutsch / MRemind-GUI.rexx < prev    next >
OS/2 REXX Batch file  |  2000-08-06  |  7KB  |  278 lines

  1. /* $VER: MRemind-GUI.rexx 1.0a (06-Aug-2000) von A.Greve */
  2.  
  3. mrname     = 'C:MicroReminder'
  4. editorname = 'CED:ED'
  5. editoropt  = ' -s'
  6.  
  7. /**************************************/
  8.  
  9. prefsfile  = 'MRemind-GUI.cfg'
  10. tempfile   = 'T:MRemind-GUI.tmp'
  11. tab        = '09'x
  12. qu         = '22'x
  13. lf         = '0a'x
  14. wintags2   = ''
  15. wt_flag    = 0
  16. rt_flag    = 1
  17. timer      = 0
  18.  
  19. appname     = 'MRemind-GUI'
  20. applongname = 'MRemind-GUI - ©2000 von Axel Greve'
  21. appinfo     = 'GUI für MicroReminder 1.1+ by Deniil715!'
  22. appversion  = '1.0a'
  23. apprelease  = '2'
  24. appdate     = '06-Aug-2000'
  25.  
  26. IF ~SHOW('LIBRARIES','tritonrexx.library') THEN DO
  27.     IF ~ADDLIB('tritonrexx.library',10,-30,0) THEN DO
  28.         SAY 'Kann die <tritonrexx.library> nicht öffnen!'
  29.         EXIT(10)
  30.     END
  31. END
  32.  
  33. IF ~SHOW('LIBRARIES','rexxtricks.library') THEN DO
  34.     IF ~ADDLIB('rexxtricks.library',10,-30,0) THEN rt_flag = 0
  35. END
  36.  
  37. SIGNAL ON break_c
  38. SIGNAL ON failure
  39. SIGNAL ON halt
  40. SIGNAL ON ioerr
  41. SIGNAL ON syntax
  42.  
  43. wintags1 =    WindowID(100),
  44.             WindowTitle(appname appversion),
  45.             WindowPosition('TRWP_CENTERDISPLAY'),
  46.                 'VertGroupA' 'SpaceB'
  47. wintags3 =            'HorizGroupAC' 'Space',
  48.                         TextID(" _Stunden",1) 'SpaceS' SliderGadget(0,23,0,1) 'Space',
  49.                     'EndGroup' 'Space',
  50.                     'HorizGroupAC' 'Space',
  51.                         TextID(" _Minuten",3) 'SpaceS' SliderGadget(0,59,1,3) 'Space',
  52.                     'EndGroup' 'Space',
  53.                     'HorizGroupAC' 'Space',
  54.                         TextID("Se_kunden",5) 'SpaceS' SliderGadget(0,59,0,5) 'Space',
  55.                     'EndGroup' 'SpaceB',
  56.                     'HorizSeparator' 'SpaceB',
  57.                     'HorizGroupC' 'Space',
  58.                         ButtonR(" Start ",98) 'SpaceB',
  59.                         'GroupBox',
  60.                         'HorizGroup' 'SpaceS',
  61.                             TextID('00',2) 'TRAT_MinWidth 2' TextN(':'),
  62.                             TextID('01',4) 'TRAT_MinWidth 2' TextN(':'),
  63.                             TextID('00',6) 'TRAT_MinWidth 2' 'SpaceS',
  64.                         'EndGroup' 'SpaceB',
  65.                         Button("Abbruch",99) 'Space',
  66.                     'EndGroup' 'SpaceB',
  67.                 'EndGroup',
  68.              'EndProject'
  69.  
  70. _ReadPrefs()
  71.  
  72. IF wt_flag THEN
  73.     wintags2 =    'HorizGroupAC' 'Space',
  74.                     Button("_Prefs",12) 'SpaceS',
  75.                     ListSS('pref',11,0,0) 'TRAT_MinWidth' minwid 'TRAT_MinHeight' 3 'Space',
  76.                 'EndGroup' 'SpaceB'
  77.  
  78. app =     TR_CREATEAPP('TRCA_Name'     '"'appname'"',
  79.                      'TRCA_LongName' '"'applongname'"',
  80.                      'TRCA_Info'     '"'appinfo'"',
  81.                      'TRCA_Version'  '"'appversion'"',
  82.                      'TRCA_Release'  '"'apprelease'"',
  83.                      'TRCA_Date'     '"'appdate'"',
  84.                      'TAG_END')
  85.  
  86. IF app ~= '00000000'x THEN DO
  87.     window = TR_OPENPROJECT(app,wintags1' 'wintags2' 'wintags3)
  88.     IF window ~= '00000000'x THEN DO
  89.         lock = C2D(window)
  90.         ende = 0
  91.         DO WHILE ende ~= 1
  92.             CALL TR_WAIT(app,'')
  93.             DO WHILE TR_HANDLEMSG(app,'event')
  94.                 IF event.trm_class = 'TRMS_NEWVALUE' THEN DO
  95.                     SELECT
  96.                         WHEN event.trm_id = 1  THEN _NewVal(2,0)
  97.                         WHEN event.trm_id = 3  THEN _NewVal(4,0)
  98.                         WHEN event.trm_id = 5  THEN _NewVal(6,0)
  99.                         WHEN event.trm_id = 11 THEN DO
  100.                             IF BITAND(D2X(event.trm_qualifier),'0200'x) = '0200'x THEN
  101.                                 _StartTimer()
  102.                             ELSE DO
  103.                                 data = event.trm_data
  104.                                 TR_SetAttribute(window,1,'TRAT_Disabled',(data ~= 0))
  105.                                 TR_SetAttribute(window,3,'TRAT_Disabled',(data ~= 0))
  106.                                 TR_SetAttribute(window,5,'TRAT_Disabled',(data ~= 0))
  107.                                 IF data = 0 THEN DO
  108.                                     _NewVal(2,1)
  109.                                     _NewVal(4,3)
  110.                                     _NewVal(6,5)
  111.                                 END
  112.                                 ELSE DO
  113.                                     data = data + 1
  114.                                     timer = timer.data
  115.                                     TR_SetAttribute(window,2,'TRAT_Text',th.data)
  116.                                     TR_SetAttribute(window,4,'TRAT_Text',tm.data)
  117.                                     TR_SetAttribute(window,6,'TRAT_Text',ts.data)
  118.                                 END
  119.                             END
  120.                         END
  121.                         WHEN event.trm_id = 12 THEN _EditPrefs()
  122.                     OTHERWISE
  123.                         NOP
  124.                     END
  125.                 END
  126.  
  127.                 IF event.trm_class = 'TRMS_ACTION' THEN DO
  128.                     SELECT
  129.                         WHEN event.trm_id = 12 THEN _EditPrefs()
  130.                         WHEN event.trm_id = 98 THEN _StartTimer()
  131.                         WHEN event.trm_id = 99 THEN ende = 1
  132.                     OTHERWISE
  133.                         NOP
  134.                     END
  135.                 END
  136.  
  137.                 IF event.trm_class = 'TRMS_CLOSEWINDOW' THEN ende = 1
  138.  
  139.             END
  140.         END
  141.         CALL TR_CLOSEPROJECT(window)
  142.     END
  143.     CALL TR_DELETEAPP(app)
  144. END
  145.  
  146. EXIT(0)
  147.  
  148. /**************************************/
  149.  
  150. _NewVal:
  151.     PARSE ARG obj,obj1
  152.     IF obj1 = 0 THEN tmp = event.trm_data
  153.     ELSE             tmp = TR_GetAttribute(window,obj1,'TRAT_Value')
  154.     TR_SetAttribute(window,obj,'TRAT_Text',RIGHT('0'tmp,2))
  155.     timer = TR_GetAttribute(window,1,'TRAT_Value') * 3600 + TR_GetAttribute(window,3,'TRAT_Value') * 60    + TR_GetAttribute(window,5,'TRAT_Value')
  156. RETURN 0
  157.  
  158. _StartTimer:
  159.     IF OPEN('fname',mrname,'R') THEN DO
  160.         CLOSE('fname')
  161.         ADDRESS COMMAND 'Run >NIL: 'mrname timer' NOSAVE'
  162.         ende = 1
  163.     END
  164.     ELSE _EasyReq(mrname)
  165. RETURN 0
  166.  
  167. _EditPrefs:
  168.     IF OPEN('fname',editorname,'R') THEN DO
  169.         CLOSE('fname')
  170.         ADDRESS COMMAND editorname''editoropt' ENV:'prefsfile
  171.         DROP dummy.
  172.         IF OPEN('fname','ENVARC:'prefsfile,'R') THEN DO
  173.             CLOSE('fname')
  174.             ADDRESS COMMAND 'Compare >'tempfile' ENV:'prefsfile' ENVARC:'prefsfile
  175.             IF RXTR_READFILE(tempfile, dummy) THEN DO
  176.                 IF dummy.0 ~= 0 THEN DO
  177.                     ADDRESS COMMAND 'Copy >NIL: ENV:'prefsfile' ENVARC:'
  178.                     _ReadPrefs()
  179.                     TR_SetAttribute(window,11,'TROB_Listview',pref)
  180.                     TR_SetAttribute(window,11,'TRLV_Top',0)
  181.                     TR_SetAttribute(window,11,'TRAT_Value',0)
  182.                     TR_SetAttribute(window,1, 'TRAT_Disabled',0)
  183.                     TR_SetAttribute(window,3, 'TRAT_Disabled',0)
  184.                     TR_SetAttribute(window,5, 'TRAT_Disabled',0)
  185.                     _NewVal(2,1)
  186.                     _NewVal(4,3)
  187.                     _NewVal(6,5)
  188.                 END
  189.             END
  190.         END
  191.         ELSE ADDRESS COMMAND 'Copy >NIL: ENV:'prefsfile' ENVARC:'
  192.         ADDRESS COMMAND 'Delete >NIL: 'tempfile
  193.     END
  194.     ELSE _EasyReq(editorname)
  195. RETURN 0
  196.  
  197. _ReadPrefs:
  198.     IF rt_flag THEN DO
  199.         DROP pref. prefs.
  200.  
  201.         IF RXTR_READFILE('ENV:'prefsfile,'prefs') THEN DO
  202.             wt_flag = 1
  203.             pref.0 = 1
  204.             pref.1 = 'Manuell'
  205.             minwid = LENGTH(pref.1)
  206.             j = 1
  207.             DO i = 1 TO prefs.0
  208.                 temp = TRANSLATE(prefs.i,' ',tab)
  209.                 temp = STRIP(temp)
  210.  
  211.                 IF LEFT(temp,1) ~= ';' & WORDS(temp) > 0 THEN DO
  212.                     temp1 = WORD(temp,1)
  213.                     temp2 = RIGHT(temp,LENGTH(temp) - WORDINDEX(temp,2) + 1)
  214.                     IF (LEFT(temp2,1) = qu) & (RIGHT(temp2,1) = qu) THEN
  215.                         temp2 = CENTER(temp2,LENGTH(temp2) - 2)
  216.  
  217.                     IF LENGTH(temp1) = 5 | LENGTH(temp1) = 8 THEN DO
  218.                         IF SUBSTR(temp1,3,1) = ':' THEN DO
  219.                             IF SUBSTR(temp1,6,1) = ':' THEN DO
  220.                                 th = LEFT(temp1,2)
  221.                                 tm = SUBSTR(temp1,4,2)
  222.                                 ts = RIGHT(temp1,2)
  223.                             END
  224.                             ELSE DO
  225.                                 th = '00'
  226.                                 tm = LEFT(temp1,2)
  227.                                 ts = SUBSTR(temp1,4,2)
  228.                             END
  229.                             IF DATATYPE(th''tm''ts) = 'NUM' THEN DO
  230.                                 DROP temp1 
  231.                                 temp1 = th * 3600 + tm * 60 + ts
  232.                                 _TakeOver()
  233.                             END
  234.                         END
  235.                     END
  236.                     ELSE DO
  237.                         IF DATATYPE(temp1) = 'NUM' THEN _TakeOver()
  238.                     END
  239.  
  240.                 END
  241.             END
  242.             minwid = minwid + 1
  243.         END
  244.     END
  245. RETURN 0
  246.  
  247. _TakeOver:
  248.     IF (temp1 > -1) & (temp1 < 86400) THEN DO
  249.         j = j + 1
  250.         timer.j = temp1
  251.         rest1 = temp1 // 3600
  252.         th.j = RIGHT('0'temp1 % 3600,2)
  253.         rest2 = rest1 // 60
  254.         tm.j = RIGHT('0'rest1 % 60,2)
  255.         ts.j = RIGHT('0'rest2,2)
  256.         pref.j = temp2
  257.         minwid = MAX(minwid,LENGTH(temp2))
  258.         pref.0 = j
  259.     END
  260. RETURN 0
  261.  
  262. _EasyReq:
  263.     PARSE ARG argum
  264.     CALL TR_EASYREQUEST(app,'Konnte »'argum'« nicht finden!',' O K ',,
  265.             'TREZ_Title' "MRemind-GUI"'a0'x"Meldung...",
  266.             'TREZ_LockProject' lock 'TAG_END')
  267. RETURN 0
  268.  
  269. break_c:
  270. failure:
  271. halt:
  272. ioerr:
  273. syntax:
  274.     SAY '+++ Fehler' rc 'in Zeile' sigl '-' ERRORTEXT(rc)
  275.     SAY SOURCELINE(sigl)
  276.     IF app ~= '00000000'x THEN CALL TR_DELETEAPP(app)
  277.     EXIT(10)
  278.